<template>
  <div id="header">
    <Header ></Header>
  </div>
  <div id="main" class="inner home-inner">
    <div class="nullData" v-if="!store.state.loading &&!store.state.isGet">
      <img src="//img06.zhaopin.cn/www/personal-img/noJobTip.png" alt="很抱歉，您搜索的内容找不到！" title="很抱歉，您搜索的内容找不到！"
        width="460" height="160" class="page-empty__image">
      <div class="page-empty__tips">
        <p>
          很抱歉，您搜索的内容找不到！
          <br>换个条件试试吧
        </p>
      </div>
    </div>
    <div class="nullData" v-if="store.state.loading && !store.state.isGet">
      <img src="//img06.zhaopin.cn/www/personal-img/noJobTip.png" alt="很抱歉，您搜索的内容找不到！" title="很抱歉，您搜索的内容找不到！"
        width="460" height="160" class="page-empty__image">
      <div class="page-empty__tips">
        <p>
          努力搜索中...
        </p>
      </div>
    </div>
    <div v-if="type == 'job' && store.state.isGet &&!store.state.loading" class="job_card" v-for="(item, index) in store.state.jobState.jobs" :key="index">
      <router-link class="job_info" :to="{ path: '/postionInfoPage', query: { jobId: item.jobId } }">
        <div class="job_top">
          <p class="job_name">{{ item.jobName }}</p>
          <p class="salary">{{ item.jobSalary }}</p>
        </div>
        <p class="job_text">
          <span class="job_time">{{ item.jobEx }}</span>
          <span class="job_edu">{{ item.jobEdu }}</span>
          <span class="job_edu">{{ item.jobAge }}</span>
        </p>
      </router-link>
      <router-link class="job_com" :to="{ path: '/eInfoPage', query: { eId: item.eId } }">
        <p class="com_text">
          <img :src="item.eAvatar" alt="">
          <span class="com_name">
            {{ item.eName }}
          </span>
        </p>
        <span class="com_place">
          {{ item.contactAddress }}
        </span>
      </router-link>

    </div>

    <div v-if="type == 'enterprise' && store.state.isGet && !store.state.loading" class="e_card" v-for="(item, index) in store.state.eState.Es" :key="index">
      <router-link :to="{ path: '/eInfoPage', query: { eId: item.eId } }">
        <div class="line_1">
          <p class="e_name">{{ item.businessName }}</p>
        </div>
        <div class="line_2">
          <ul style="display: flex;">
            <li class="e_li">性质：{{ item.eNature }}</li>
            <li class="e_li">规模：{{ item.eSizeMin }}-{{ item.eSizeMax }}人</li>
            <li class="e_li">行业：{{ item.eIndustry }}</li>
          </ul>
        </div>
        <div class="line_3">
          <p>地址：{{ item.contactAddress }}</p>
        </div>
      </router-link>

    </div>

  </div>



</template>

<script lang="ts" >
export default {
  name: "SearchPage",
};
</script>

<script lang="ts"  setup>
import Header from "@/components/Header.vue"
import { reactive, ref, onBeforeMount, onMounted, computed, watch } from "vue";
import { RouterLink, useRoute, useRouter } from 'vue-router';
import { useStore } from "vuex"
import { getAllJobInfo, getAllEInfo,searchJobs } from "@/api/authApi"
import { getEAvatar } from "@/api/enterpriseApi"

const route = useRoute()
const store = useStore()
const router = useRouter()
const isShow = ref()

const type = computed(() => store.state.searchType)


</script>

<style scoped>
.inner {
  width: 1160px;
  margin: 0 auto;
}

.home-inner {
  max-width: 1160px;
}

#header {
  font-family: '微软雅黑';
  height: 58px;
  background-color: #545c64;
}

#main {
  margin-top: 25px;
  height: 800px;
  /* background-color: rgb(240, 240, 240); */
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 没有数据 */

.nullData {
  position: relative;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  width: 100%;
  height: 440px;
  background: #fff;
  overflow: hidden;
}

.page-empty__image {
  width: 460px;
  height: 160px;
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -80px;
  margin-left: -230px;
}

.page-empty__tips {
  /* background-color: #FFF; */
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
  line-height: 26px;
  font-size: 16px;
  color: #666;
}

/* 卡片 */
/* 公司 */
.e_name {
  color: #2052a4;
  font-size: 24px;
  padding-left: 10px;
}

.line_3 {
  padding-left: 10px;
  /* width: 400px; */
  /* display: inline-flex; */
}

.line_2 {
  height: 35px;
  margin-top: 5px;
  /* width: 400px; */
  /* display: inline-flex; */
}

.e_li {
  color: black;
  font-size: 18px;
  padding-left: 10px;
}

.line_1 {
  height: 35px;

}

.e_card {
  box-sizing: border-box;
  padding: 10px;
  margin-right: 10px;
  margin-top: 20px;
  background-color: #FFFF;
  height: 136px;
  width: 940px;

}

.e_card:hover {
  transition: border linear .2s;
  box-shadow: 0 0 18px rgba(213, 208, 213, 3);
}

/* 岗位 */
.job_title {
  border-bottom: 2px solid rgb(210, 202, 202);
  height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 36px;
  font-weight: bold;
  font-family: '微软雅黑';

}

.job_card {
  margin-right: 10px;
  margin-top: 20px;
  background-color: #FFFF;
  height: 136px;
  width: 940px;

}

.job_card:hover {
  transition: border linear .2s;
  box-shadow: 0 0 18px rgba(213, 208, 213, 3);
}

a {
  text-decoration: none;
  /* 将a里面的元素写进他的范围内 a为行元素*/
  display: inline-block
}

.job_info {
  /* 流式布局，会把borders和padding全都包含在定义的宽高，这样内容不会超出范围 */
  box-sizing: border-box;
  width: 100%;
  padding: 16px 20px;
}

.job_top {
  margin-bottom: 6px;
  height: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.salary {
  color: rgb(208, 9, 9);
}

.job_text {
  height: 22px;
  margin-top: 10px;
  display: flex;
  align-items: center;

}

p {
  color: black;
  margin: 0;
  padding: 0;
  font-size: 17px;
  font-family: '微软雅黑';
}

span {
  font-size: 12px;
  font-weight: 500;
  color: rgb(104, 104, 104);
  background-color: rgb(246, 246, 246);
  padding: 1px 0px 2px 5px;
  padding-left: 5px;
  padding-right: 5px;
  border-radius: 10px;
  font-family: '微软雅黑';
  /* margin: 0 0 4px 0; */
}

.job_time {
  margin-right: 2px;
}

.job_edu {
  margin-left: 2px;
}

.job_com {
  display: inline-flex;
  box-sizing: border-box;
  width: 100%;
  padding: 13px 18px;
  align-items: center;
  justify-content: space-between;
  background-color: rgb(246, 246, 246);
}

img {
  border-radius: 5px;
  height: 24px;
  width: 24px;
}

.com_text {
  display: flex;
  align-items: center;
}

.com_name {
  font-size: 16px;
}

.com_place {
  font-size: 14px;
}
</style>